impl Solution {
    pub fn find_nth_digit(mut n: i32) -> i32 {
        if n<10{
            return n;
        }
        let mut l=0;
        for i in 1_i32..10{
            let t:i64=10_i64.pow((i-1) as u32)*(i as i64)*9;
            if t>n as i64{
                l=i;
                break;
            }else{
                n-=t as i32;
            }
        };
        let mut num =n/l+10_i32.pow((l-1)as u32)-1;
        let p=n%l;
        if p==0{
            return num-(num/10)*10;
        }else{
            num+=1;
            return num/10_i32.pow((l-p)as u32)%10;
        }


        
    }
}